package com.jch.dm1_immutable_object.demo;

// 角色： ImmutableObject
public final class TestImmutableObject {

    private final String stateStr;
    private final int stateInt;

    public TestImmutableObject(String stateStr, int stateInt) {
        this.stateStr = stateStr;
        this.stateInt = stateInt;
    }

    public String getStateStr() {
        return stateStr;
    }

    public int getStateInt() {
        return stateInt;
    }

    public TestImmutableObject getStateSnapshot(){
        return new TestImmutableObject(this.getStateStr(),this.getStateInt());
    }

    @Override
    public String toString() {
        return "TestImmutableObject{" +
                "stateStr='" + stateStr + '\'' +
                ", stateInt=" + stateInt +
                '}';
    }
}
